import { rcaNumberFormat,rcaNumberFormat0,rcaNumberFormat4 } from './common.js'
import { commonTableOption } from './common.js'

import { dateFormat } from '@/util/date';
export const startDate = dateFormat(new Date(), 'yyyy-MM-') + '01';
export const endDate = dateFormat(new Date(), 'yyyy-MM-dd');

export const prefixInteger = function (num, n) {
  return (Array(n).join(0) + num).slice(-n);
}

export const tableOption = {
  ...commonTableOption,
  height:400,
  // menu: true,
  // editBtn: false,
  // delBtn: false,
  column: [
    {
      type: 'select',
      label: '线路',
      prop: 'lineCode',
      search: true,
      display: true,
      props: {
         label: 'name',
         value: 'code'
         },
    /*  
	dicData: [{
        label: '1号线一期',
        value: "41"
      },{
        label: '2号线',
        value: "42"
      },{
        label: '3号线',
        value: "43"
      },{
        label: '4号线',
        value: "44"
      },{
        label: '5号线一期',
        value: "45"
      },{
        label: '6号线',
        value: "46"
      },{
        label: '9号线',
        value: "49"
      },{
        label: '机场城际',
        value: "54"
      },{
        label: '1号线二期',
        value: "71"
      },{
        label: '5号线二期',
        value: "72"
      }]*/
      dicUrl: '/support/swparamline/dictoperator',
    }, {
      type: 'date',
      label: '日期',
      prop: 'tradeDate',
      searchSpan: 12,
      searchRange: true,
      search: true,
      searchValue: [startDate, endDate],      // 这是我获取的默认的显示日期，我这里是['2020-08-04', '2020-09-22']
      format: 'yyyy-MM-dd',                  // 这是组件展示的日期格式
      valueFormat: 'yyyy-MM-dd',
    }, {
      type: 'input',
      showSummary: true,
      precision: 4,
      formatter: (row, value, label, column) => {
        return rcaNumberFormat4(value)
      },
      label: '单程票合计金额',
      prop: 'onewayMoney'
    }, {
      type: 'input',
      showSummary: true,
      precision: 4,
      formatter: (row, value, label, column) => {
        return rcaNumberFormat4(value)
      },
      label: '二维码电子票合计金额',
      prop: 'qrMoney'
    }, {
      type: 'input',
      showSummary: true,
      precision: 4,
      formatter: (row, value, label, column) => {
        return rcaNumberFormat4(value)
      },
      label: '人脸电子票合计金额',
      prop: 'faceMoney'
    }, {
      type: 'input',
      showSummary: true,
      precision: 4,
      formatter: (row, value, label, column) => {
        return rcaNumberFormat4(value)
      },
      label: '长安通合计金额',
      prop: 'smartCardMoney'
    }, {
      type: 'input',
      showSummary: true,
      precision: 4,
      formatter: (row, value, label, column) => {
        return rcaNumberFormat4(value)
      },
      label: '交通一卡通合计金额',
      prop: 'trafficSmartCardMoney'
    }, {
      type: 'input',
      showSummary: true,
      precision: 4,
      formatter: (row, value, label, column) => {
        return rcaNumberFormat4(value)
      },
      label: '合计金额',
      prop: 'totalMoney'
    }]
}

export const previewTableOption = {
  ...commonTableOption,
  page: false,
  column: [
    {
      type: 'select',
      label: '线路',
      prop: 'lineCode',
      display: true,
      props: {
        label: 'name',
        value: 'code'
      },
      dicUrl: '/support/swparamline/dictoperator',
    }, {
      type: 'date',
      label: '日期',
      prop: 'tradeDate',
    }, {
      type: 'input',
      showSummary: true,
      precision: 4,
      formatter: (row, value, label, column) => {
        return rcaNumberFormat4(value)
      },
      label: '单程票合计金额',
      prop: 'onewayMoney'
    }, {
      type: 'input',
      showSummary: true,
      precision: 4,
      formatter: (row, value, label, column) => {
        return rcaNumberFormat4(value)
      },
      label: '二维码电子票合计金额',
      prop: 'qrMoney'
    }, {
      type: 'input',
      showSummary: true,
      precision: 4,
      formatter: (row, value, label, column) => {
        return rcaNumberFormat4(value)
      },
      label: '人脸电子票合计金额',
      prop: 'faceMoney'
    }, {
      type: 'input',
      showSummary: true,
      precision: 4,
      formatter: (row, value, label, column) => {
        return rcaNumberFormat4(value)
      },
      label: '长安通合计金额',
      prop: 'smartCardMoney'
    }, {
      type: 'input',
      showSummary: true,
      precision: 4,
      formatter: (row, value, label, column) => {
        return rcaNumberFormat4(value)
      },
      label: '交通一卡通合计金额',
      prop: 'trafficSmartCardMoney'
    }, {
      type: 'input',
      showSummary: true,
      precision: 4,
      formatter: (row, value, label, column) => {
        return rcaNumberFormat4(value)
      },
      label: '合计金额',
      prop: 'totalMoney'
    }]
}
